home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / zendisk2.zip / LST11-19.ASM < prev    next >
Assembly Source File  |  1990-02-15  |  1KB  |  54 lines

  1. ;
  2. ; *** Listing 11-19 ***
  3. ;
  4. ; Tests whether several characters are in the set
  5. ; {A,Z,3,!} by using REPNZ SCASB.
  6. ;
  7.     jmp    Skip
  8. ;
  9. ; List of characters in the set.
  10. ;
  11. TestSet    db    "AZ3!"
  12. TEST_SET_LENGTH    equ    ($-TestSet)
  13. ;
  14. ; Determines whether a given character is in TestSet.
  15. ;
  16. ; Input:
  17. ;    AL = character to check for inclusion in TestSet
  18. ;
  19. ; Output:
  20. ;    Z if character is in TestSet, NZ otherwise
  21. ;
  22. ; Registers altered: DI, ES
  23. ;
  24. ; Direction flag cleared
  25. ;
  26. CheckTestSetInclusion:
  27.     push    ds
  28.     pop    es
  29.     mov    di,offset TestSet
  30.             ;point ES:DI to the set in which to
  31.             ; check inclusion
  32.     mov    cx,TEST_SET_LENGTH
  33.             ;# of characters in TestSet
  34.     cld
  35.     repnz    scasb    ;search the set for this character
  36.     ret        ;the success status is already in
  37.             ; the Zero flag
  38. ;
  39. Skip:
  40.     call    ZTimerOn
  41.     mov    al,'A'
  42.     call    CheckTestSetInclusion    ;check 'A'
  43.     mov    al,'Z'
  44.     call    CheckTestSetInclusion    ;check 'Z'
  45.     mov    al,'3'
  46.     call    CheckTestSetInclusion    ;check '3'
  47.     mov    al,'!'
  48.     call    CheckTestSetInclusion    ;check '!'
  49.     mov    al,' '
  50.     call    CheckTestSetInclusion    ;check space, so
  51.                     ; we get a failed
  52.                     ; search
  53.     call    ZTimerOff
  54.